<?php 
include("../amazon_api_class.php");
if(isset($_GET['val']) && $_GET['val']!="")
{
	

    $obj = new AmazonProductAPI();
    
    try
    {
        $result = $obj->searchProducts("a",
                                       AmazonProductAPI::DVD,
                                       "TITLE");
    }
    catch(Exception $e)
    {
        echo $e->getMessage();
    }
	
	foreach ($result->Items->Item as $item)
    {
      	?>
        <div class="product" style="width:400px; padding:5px 5px 5px 5px;">
        <table width="100%" style="width:400px; border:1px solid #E4E4E4" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="15%" align="center" valign="middle">
            <img src="<?php echo $item->SmallImage->URL;?>" border="0" />
            </td>
            <td width="74%" align="left" valign="middle" class="font12">
			<?php  
                if($item->ItemAttributes->Title!=""){echo "{$item->ItemAttributes->Title}<br>";}
                if($item->ItemAttributes->Author!=""){echo "By: {$item->ItemAttributes->Author}<br>";}
                if($item->ItemAttributes->Publisher!=""){echo "{$item->ItemAttributes->Publisher}<br>";}
				if($item->ItemAttributes->PublicationDate!=""){echo "{$item->ItemAttributes->PublicationDate}<br>";}
				?></td>
            <td width="11%" align="center" valign="middle">
            <img src="../images/select.png" border="0" />
            </td>
          </tr>
        </table>
        </div>
        <?php
    }
}
?>    